import { ILoading } from "./interface";

const loading: ILoading = {
  namespaced: true,
  state: {
    loading: false,
  },
  actions: {
    show({ commit }) {
      commit({
        type: "SHOW",
      });
    },
    hidden({ commit }) {
      commit({
        type: "HIDDEN",
      });
    },
  },
  mutations: {
    SHOW(state) {
      state.loading = true;
    },
    HIDDEN(state) {
      state.loading = false;
    },
  },
};

export default loading;
